// 用户相关的moc接口数据
export default [
  {
    url: '/api/login',
    method: 'post',
    response: ({ body }) => {
      const { username, password } = body;
      if (username === 'admin' && password === '123456') {
        // 管理员
        return {
          code: 20000,
          message: "登录成功",
          data: {
            accessToken: 'vue3-admin-template',
            refreshToken: 'vue3-admin-template',
          }
        };
      } else {
        return { code: 40000, message: '用户名或密码错误' };
      }
    }
  },
  {
    url: '/api/user/info',
    method: 'get',
    response: () => {
      return {
        code: 20000,
        data: {
          user: {
            username: 'admin',
            email: 'admin@test.com',
            roles: ['admin']
          },
          // 动态路由
          routes: [
            {
              path: '/system',
              name: 'system',
              component: 'Layout',
              meta: { title: '系统管理' },
              children: [
                {
                  path: '/system/role',
                  name: 'role',
                  component: 'Role',
                  meta: { title: '角色管理' }
                },
                {
                  path: '/system/menu',
                  name: 'menu',
                  component: 'Menu',
                  meta: { title: '菜单管理' }
                }
              ]
            }
          ]
        },
        message: '获取用户信息成功'
      }
    }
  },
  {
    url: '/api/logout',
    method: 'post',
    response: () => {
      return {
        code: 0,
        message: '登出成功'
      };
    }
  }
];
